'use strict';

function compute_chain_median(collection) {
  //在这里写入代码
 let arr = collection.split("->");
 let arr1= arr.sort(function(a, b) {
  return a - b;
});
//console.log(arr1);
  if(arr1.length%2===0)
  {
    return (parseInt(arr1[arr1.length/2])+parseInt( arr1[(arr1.length/2)-1]))/2;
  }
  else
  {
    return parseInt( arr1[(arr1.length-1)/2]);

  }
  return arr1;
}

module.exports = compute_chain_median;
